package com.woniu.controller;

import com.woniu.entity.RbacMenu;
import com.woniu.entity.ResponseEntity;
import com.woniu.service.RbacMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author:陈涵
 * @Do:菜单控制器
 * @date: 2022/9/12 15:08
 */
@RestController
@RequestMapping("/rbacMenu")
public class RbacMenuController {
    @Autowired
    RbacMenuService rbacMenuServicel;
    @GetMapping("/")
    public ResponseEntity findAllMenu(){
        return rbacMenuServicel.findAllMenu();
    }
    @PutMapping("/")
    public ResponseEntity editOne(@RequestBody RbacMenu rbacMenu){
        return rbacMenuServicel.editOne(rbacMenu);
    }
    @PutMapping("/{id}/{fid}")
    public ResponseEntity updateMenu(@PathVariable("id") int id, @PathVariable("fid") Integer fid){
        return rbacMenuServicel.updateMenu(id,fid);
    }
    @PutMapping("/updateOrder/{order}/{id}")
    public ResponseEntity updateOrder(@PathVariable("order") Integer order,@PathVariable("id") Integer id){
        return rbacMenuServicel.updateOrder(order,id);
    }
    @GetMapping("/getMenuByRoleId/{id}")
    public ResponseEntity getMenuByRoleId(@PathVariable("id") Integer id){
        return rbacMenuServicel.getMenuByManaId(id);
    }
}
